//
//  XJComposeToolbar.m
//  weiboOC
//
//  Created by 徐绩 on 16/5/3.
//  Copyright © 2016年 ayumi. All rights reserved.
//

#import "XJComposeToolbar.h"

typedef NS_ENUM(NSUInteger, ComposeToolbarBtnType) {
    ComposeToolbarBtnTypePicture,
    ComposeToolbarBtnTypeMention,
    ComposeToolbarBtnTypeTrend,
    ComposeToolbarBtnTypeEmoticon,
    ComposeToolbarBtnTypeAdd
};


@implementation XJComposeToolbar


-(instancetype)initWithFrame:(CGRect)frame{

    if (self = [super initWithFrame:frame]) {
        [self setupUI];
    }
    return self;
}

#pragma mark - 布局界面
-(void)setupUI{

    self.distribution = UIStackViewDistributionFillEqually;
    [self addChildBtn:@"compose_toolbar_picture" type:ComposeToolbarBtnTypePicture];
    [self addChildBtn:@"compose_mentionbutton_background" type:ComposeToolbarBtnTypeMention];
    [self addChildBtn:@"compose_trendbutton_background" type:ComposeToolbarBtnTypeTrend];
    [self addChildBtn:@"compose_emoticonbutton_background" type:ComposeToolbarBtnTypeEmoticon];
    [self addChildBtn:@"compose_add_background" type:ComposeToolbarBtnTypeAdd];
}

-(void)addChildBtn:(NSString *)imageName type:(ComposeToolbarBtnType )type{

    UIButton *btn = [[UIButton alloc]init];
    [btn addTarget:self action:@selector(didClickComposeToolbarBtn:) forControlEvents:UIControlEventTouchUpInside];
    
    [btn setImage:[UIImage imageNamed:imageName] forState:UIControlStateNormal];
    [btn setImage:[UIImage imageNamed:[NSString stringWithFormat:@"%@_highlighted",imageName]] forState:UIControlStateHighlighted];
    [btn setBackgroundImage:[UIImage imageNamed:@"compose_toolbar_background"] forState:UIControlStateNormal];
    [btn setBackgroundImage:[UIImage imageNamed:@"compose_toolbar_background"] forState:UIControlStateHighlighted];
    [self addArrangedSubview:btn];
    
}
#warning
#pragma mark - 点击composeToolbarBtn
-(void)didClickComposeToolbarBtn:(UIButton *)button{


}


@end
